const ninjaPromise = new Promise((resolve, reject) => {
    resolve("Hattori");
});

// ninjaPromise.then(ninja=> {
//     console.log(ninja);
// }, err=>{
//     console.error("a error")
// });

console.log("At code start");
var ninjaDelayedPromise = new Promise((resolve, reject) => {
    console.log("ninjaDelayedPromise executor");
    setTimeout(()=>{
        console.log("Resolving ninjaDelayedPromise");
        resolve("Hattori");
    }, 500);
});

console.log(ninjaDelayedPromise);
ninjaDelayedPromise.then(ninja=>{
    console.log(ninja + '=== Hattori');
});

const ninjaImmediatePromise = new Promise((resolve, reject) => {
    console.log("ninjaImmediatePromise executor. Immediate resolve.");
    resolve("Yoshi");
});
ninjaImmediatePromise.then(ninja => {
    console.log(ninja + '=== Yoshi');
});
console.log("At code end");